package org.wmq.taskschedule.factory;

import org.springframework.beans.BeanUtils;
import org.wmq.taskschedule.algorithm.AlgorithmExecutor;
import org.wmq.taskschedule.algorithm.ImageBinarizationExecutor;
import org.wmq.taskschedule.biz.model.DO.Param;

/**
 * 图像二值化算法执行器工厂类
 * 实现AlgorithmExecutorFactory接口，用于创建ImageBinarizationExecutor实例
 */
public class ImageBinarizationExecutorFactory implements AlgorithmExecutorFactory {
    private static final ImageBinarizationExecutorFactory instance = new ImageBinarizationExecutorFactory();

    private ImageBinarizationExecutorFactory() {}
    
    /**
     * 获取工厂实例
     * @return ImageBinarizationExecutorFactory实例
     */
    public static ImageBinarizationExecutorFactory getInstance() {
        return instance;
    }
    
    @Override
    public AlgorithmExecutor getAlgorithmExecutor(Param param) {
        ImageBinarizationExecutor imageBinarizationExecutor = new ImageBinarizationExecutor();
        BeanUtils.copyProperties(param, imageBinarizationExecutor);
        return imageBinarizationExecutor;
    }
}
